//
//  CAlipayManager.m
//  Jiankang
//
//  Created by 丁攀 on 2017/12/23.
//  Copyright © 2017年 Facebook. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CAlipayManager.h"
#import <React/RCTLog.h>

@implementation CAlipayManager

RCT_EXPORT_MODULE();

RCT_REMAP_METHOD(pay,
                 orderString:(NSString *)orderString
                 payWithResolver:(RCTPromiseResolveBlock)resolve
                 rejecter:(RCTPromiseRejectBlock)reject)
{
  NSString *appScheme = @"alipay2017062007529154";
  [[AlipaySDK defaultService] payOrder:orderString fromScheme:appScheme callback:^(NSDictionary *resultDic) {
    NSLog(@"reslut = %@",resultDic);
    if (resultDic) {
      resolve(resultDic);
    } else {
      NSError* error = nil;
      reject(@"pay error", @"pay error", error);
    }
  }];
}

@end
